<!DOCTYPE html>
<html class="x-admin-sm">
    {include file='public/header'}
    <script src="/admin/xadmin/lib/layui/upload.js" charset="utf-8"></script>

    <body>
        <div class="x-body">
            <form class="layui-form" lay-filter="formAjax">
          

                <div class="layui-form-item" style="display: flex;">
                    <label class="layui-form-label">
                        小程序
                    </label>
                    <div id="applets" style="width: 100%;flex: 1;"></div>
                </div>

                <input type="hidden" name="applet_ids" id="applet_ids" value=""/>
                <input type="hidden" name="video_id" id="video_id" value=""/>
                <button id="submitData" class="layui-btn" lay-submit lay-filter="submitData" style="display: none;"/>
            </form>
        </div>
        <script>
            let params = {
             
                editUrl: '/admin/mediaAssets/wechatAuthorize'
            }
           
            form_ajax(params)
            let id = GetQueryString('id')
            console.log("idddddddd",id);
            $('#video_id').val(id)
            let str = GetQueryString('data')
            let datas= str.split(',')
        
            let xmSelectappletsOption = {
                url: '/admin/applet/select?type=1',
                initValue: '', // 初始值
                el: '#applets',
                showCount: 4,
                pageSize: 5,
                onFn: function (data) {
                    if (data.arr.length !== 0) {

                        let arr = data.arr.map(item => {
                            return item.id
                        })
                        $('input[name="applet_ids"]').val(arr)
                        
                    } else {
                        $('input[name="applet_ids"]').val('')
                    }
                }

            }
            xmSelectappletsOption.initValue =  datas
            xmSelectA(xmSelectappletsOption)

         


            if (id) {
                
               
                xmSelectA(xmSelectappletsOption)
            } else {
                xmSelectA(xmSelectappletsOption)
            }
           
        </script>
    </body>

</html>
